<!DOCTYPE html>
<html lang="en">

<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
	<meta name="keywords" content="debug" />
	<meta name="description" content="debug" />
	<!-- 网页标签标题 -->
	<title>debug</title>
	<link rel="shortcut icon" href="/img/docsite.ico"/>
	<link rel="stylesheet" href="/build/documentation.css" />
</head>
<body>
	<div id="root"><div class="documentation-page" data-reactroot=""><header class="header-container header-container-normal"><div class="header-body"><a href="/en-us/index.html"><img class="logo" src="/img/txlcn.png"/></a><div class="search search-normal"><span class="icon-search"></span></div><span class="language-switch language-switch-normal">中</span><div class="header-menu"><img class="header-menu-toggle" src="/img/system/menu_gray.png"/><ul><li class="menu-item menu-item-normal"><a href="/en-us/index.html" target="_self">Home</a></li><li class="menu-item menu-item-normal"><a href="https://bbs.txlcn.org/viewtopic.php?id=42" target="_self">News</a></li><li class="menu-item menu-item-normal"><a href="https://bbs.txlcn.org/" target="_self">Forum</a></li><li class="menu-item menu-item-normal"><a href="/en-us/docs/preface.html" target="_self">Docs</a></li><li class="menu-item menu-item-normal"><a href="https://github.com/codingapi/tx-lcn/releases" target="_blank">Download</a></li><li class="menu-item menu-item-normal"><a href="/en-us/sponsor/index.html" target="_self">Sponsor</a></li></ul></div></div></header><div class="bar"><div class="bar-body"><img src="/img/system/docs.png" class="front-img"/><span>Documents</span><img src="/img/system/docs.png" class="back-img"/></div></div><section class="content-section"><div class="sidemenu"><div class="sidemenu-toggle"><img src="https://img.alicdn.com/tfs/TB1E6apXHGYBuNjy0FoXXciBFXa-200-200.png"/></div><ul><li class="menu-item menu-item-level-1"><span>User Guide</span><ul><li style="height:36px;overflow:hidden" class="menu-item menu-item-level-2"><a href="/en-us/docs/preface.html" target="_self">Preface</a></li><li style="height:36px;overflow:hidden" class="menu-item menu-item-level-2"><a href="/en-us/docs/background.html" target="_self">Background</a></li><li style="height:36px;overflow:hidden" class="menu-item menu-item-level-2"><a href="/en-us/docs/start.html" target="_self">Quick Start</a></li><li style="height:36px;overflow:hidden" class="menu-item menu-item-level-2"><a href="/en-us/docs/dependencies.html" target="_self">Dependencies</a></li><li style="height:36px;overflow:hidden" class="menu-item menu-item-level-2"><span>Demos<img style="transform:rotate(-90deg)" class="menu-toggle" src="/img/system/arrow_down.png"/></span><ul><li class="menu-item menu-item-level-3"><a href="/en-us/docs/demo/env.html" target="_self">DTX Demo</a></li><li class="menu-item menu-item-level-3"><a href="/en-us/docs/demo/dubbo.html" target="_self">Dubbo of TC</a></li><li class="menu-item menu-item-level-3"><a href="/en-us/docs/demo/springcloud.html" target="_self">Springcloud of TC</a></li></ul></li><li style="height:36px;overflow:hidden" class="menu-item menu-item-level-2"><span>In-depth TXLCN<img style="transform:rotate(-90deg)" class="menu-toggle" src="/img/system/arrow_down.png"/></span><ul><li class="menu-item menu-item-level-3"><a href="/en-us/docs/principle/control.html" target="_self">Explain</a></li><li class="menu-item menu-item-level-3"><a href="/en-us/docs/principle/lcn.html" target="_self">LCN Transaction Mode</a></li><li class="menu-item menu-item-level-3"><a href="/en-us/docs/principle/tcc.html" target="_self">TCC Transaction Mode</a></li><li class="menu-item menu-item-level-3"><a href="/en-us/docs/principle/txc.html" target="_self">TXC Transaction Mode</a></li></ul></li><li style="height:36px;overflow:hidden" class="menu-item menu-item-level-2"><span>Settings<img style="transform:rotate(-90deg)" class="menu-toggle" src="/img/system/arrow_down.png"/></span><ul><li class="menu-item menu-item-level-3"><a href="/en-us/docs/setting/client.html" target="_self">TC Settigns</a></li><li class="menu-item menu-item-level-3"><a href="/en-us/docs/setting/manager.html" target="_self">TM Settings</a></li><li class="menu-item menu-item-level-3"><a href="/en-us/docs/setting/distributed.html" target="_self">LoadBalance and TM Cluster</a></li></ul></li><li style="height:36px;overflow:hidden" class="menu-item menu-item-level-2"><span>Extensions<img style="transform:rotate(-90deg)" class="menu-toggle" src="/img/system/arrow_down.png"/></span><ul><li class="menu-item menu-item-level-3"><a href="/en-us/docs/expansion/transaction.html" target="_self">Transaction Mode</a></li><li class="menu-item menu-item-level-3"><a href="/en-us/docs/expansion/message.html" target="_self">TXMSG&#x27;s Protocol</a></li><li class="menu-item menu-item-level-3"><a href="/en-us/docs/expansion/rpc.html" target="_self">TXMSG</a></li></ul></li><li style="height:36px;overflow:hidden" class="menu-item menu-item-level-2"><a href="/en-us/docs/communication.html" target="_self">Command of TXMSG</a></li><li style="height:36px;overflow:hidden" class="menu-item menu-item-level-2"><a href="/en-us/docs/manageradmin.html" target="_self">TM guide</a></li><li style="height:36px;overflow:hidden" class="menu-item menu-item-level-2"><a href="/en-us/docs/debug.html" target="_self">When troubles</a></li><li style="height:36px;overflow:hidden" class="menu-item menu-item-level-2"><a href="/en-us/docs/test.html" target="_self">Test report</a></li><li style="height:36px;overflow:hidden" class="menu-item menu-item-level-2"><a href="/en-us/docs/developer.html" target="_self">Developers</a></li><li style="height:36px;overflow:hidden" class="menu-item menu-item-level-2"><a href="/en-us/docs/fqa.html" target="_self">FQA</a></li></ul></li></ul></div><div class="doc-content markdown-body"><h1>问题排查手册</h1>
<h2>一、概述</h2>
<p>TxManager 和 TxClient 都支持日志记录到数据库（TXManager默认开启日志记录）。<br>
日志记录格式：<br>
<img src="../../img/t_logger.png" alt="t_logger"></p>
<blockquote>
<p>group_id: 分布式事务组标示<br>
unit_id: 参与分布式事务的某个节点标示
tag:日志分类
content:日志内容
app_name:日志分类（应用级）</p>
</blockquote>
<h2>二、在日志开启后的问题排查</h2>
<h3>1、TxClient</h3>
<ul>
<li>事务组会话完整性检测</li>
</ul>
<pre><code class="language-sql"><span class="hljs-keyword">select</span> * <span class="hljs-keyword">from</span> t_logger <span class="hljs-keyword">where</span> t_logger.group_id = <span class="hljs-string">'99937859659434961'</span>
</code></pre>
<p>整个DTX下，TxClient某个事务组内容如下完整日志日路如下：<br>
<img src="../../img/tx_session.png" alt="tx_session"></p>
<ul>
<li>某个微服务某次事务会话</li>
</ul>
<pre><code class="language-sql"><span class="hljs-keyword">select</span> * 
<span class="hljs-keyword">from</span> t_logger 
<span class="hljs-keyword">where</span> t_logger.group_id = <span class="hljs-string">'99937859659434961'</span> <span class="hljs-keyword">and</span> app_name=<span class="hljs-string">'spring-demo-d'</span>
</code></pre>
<ul>
<li>其它。根据情况按日志字段查看日志记录</li>
</ul>
<h5>日志解读：</h5>
<ul>
<li>日志分类-应用:<br>
若基于默认配置，即非单独分配日志数据库时，日志会分别存在于各业务数据库下。若集中存储日志时，则可以按此字段查找整个事务到某个模块下的信息</li>
<li>日志分类-TAG:<br>
transaction: 事务信息<br>
task: 补偿任务信息<br>
txc: TXC模式事务信息<br>
lcn: LCN模式事务信息<br>
tcc: TCC模式事务信息</li>
<li>日志内容:<br>
pre business code: 准备业务代码<br>
[start]create group：创建分布式事务组<br>
do business code：执行业务代码<br>
business code success： 业务代码执行成功<br>
[txc]write undo log 193： 记录回滚sql<br>
[join]join group： 加入事务组<br>
[join,task]start delay checking task：开始补偿任务<br>
[start]notify group 1：通知事务组（提交/回滚）<br>
clean transaction：清理事务<br>
[txc]clear undo log：清理回滚sql<br>
[join,task]stop delay checking task：关闭补偿任务<br>
clean transaction over：事务清理成功</li>
</ul>
<h3>2、TxManager</h3>
<p>TxManager 提供后台管理服务。<a href="manageradmin.html">详情</a></p>
</div></section><footer class="footer-container"><div class="footer-body"><img src="/img/txlcn.png"/><div class="cols-container"><div class="col col-12"><h3>Vision</h3><p>We will devote ourselves to creating a fast, efficient and concurrent distributed transaction solution.</p></div><div class="col col-6"><dl><dt>Navigation</dt><dd><a href="/zh-cn/docs/txlcn-arch.html" target="_self">TX-LCN Solution</a></dd><dd><a href="/zh-cn/docs/start.html" target="_self">Get Started</a></dd><dd><a href="/zh-cn/docs/txlcn-mod.html" target="_self">Develop Plan</a></dd><dd><a href="https://bbs.txlcn.org/viewforum.php?id=8" target="_self">Report Bug</a></dd></dl></div><div class="col col-6"><dl><dt>Friendship Link</dt><dd><a href="https://www.codingapi.com/" target="_blank">CodingApi</a></dd></dl></div></div><div class="copyright"><span>Copyright © 2018 CodingApi</span></div></div></footer></div></div>
	<script src="https://f.alicdn.com/react/15.4.1/react-with-addons.min.js"></script>
	<script src="https://f.alicdn.com/react/15.4.1/react-dom.min.js"></script>
	<script>
		window.rootPath = '';
  </script>
	<script src="/build/documentation.js"></script>
</body>
</html>